<template>
  <div class="home">
    <el-container class="container">
      <el-aside width="200px">
        <!-- 侧边栏组件 -->
        <home-aside></home-aside>
      </el-aside>
      <el-container>
        <!-- 头部 -->
        <el-header>
          <div class="headerleft">
            <p><img src="./images/rabbit.png" class="headerlogo" /></p>
            <input
              type="text"
              placeholder="请输入你想要搜索的内容..."
              class="headersearch"
            />
          </div>
          <div>
            <el-dropdown>
              <span type="primary">{{ loginuser }}</span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click="exitLogin">退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </el-header>

        <el-main>
          <!-- 子路由出口 -->
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import HomeAside from "./HomeAside";
export default {
  name: "Home",
  data() {
    return {
      loginuser: "登录账户",
    };
  },
  components: {
    HomeAside,
  },
  created() {
    this.loginuser = localStorage.getItem("loginuser");
  },
  methods: {
    exitLogin() {
      alert(1);
      // this.$router.push({
      //   name: "loginpage",
      // });
    },
  },
};
</script>

<style lang="scss">
.home {
  .container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  .el-header {
    display: flex;
    justify-content: space-between;
    background-color: #ffffff;
    color: #333;
    text-align: center;
    line-height: 60px;
    .headerleft {
      display: flex;
    }
    .headersearch {
      height: 20px;
      padding: 5px;
      outline: none;
      border: 0px;
      margin-top: 18px;
      border-bottom: 1px solid #e9eef3;
    }
    .headerlogo {
      margin-bottom: 12px;
    }
  }
  .el-aside {
    background-color: #001e34;
    color: #333;
    height: 100%;
    text-align: center;
  }

  .el-main {
    background-color: #e9eef3;
    color: #333;
  }
}
</style>